﻿namespace Solute;
public class Mysolution
{
    public void FindNumber(int[]arr,out int sum,out int max,out int min)
    {
        max = arr[0];
        min = arr[0];
        sum = 0;
        foreach(int i in arr)
        {
            max = max > i ? max : i;
            min = min < i ? min : i;
            sum = sum + i;
        }
    }
    public static void Main(string[] args)
    {
        Mysolution solution = new Mysolution();
        Console.WriteLine("请输入数组的长度");
        int length = int.Parse(Console.ReadLine());
        int[] arr = new int[length];
        for(int i = 0; i < length; i++)
        {
            Console.WriteLine($"请输入第{i + 1}个元素:");
            arr[i] = int.Parse(Console.ReadLine());
        }
        int max;
        int min;
        int sum;
        solution.FindNumber(arr, out sum, out max, out min);
        Console.Write($"最大值为{max},最小值为{min},和为{sum}");
    }
}
